function showChart(chartNumber) {
	if(chartNumber == null)
		chartNumber = 0;
	
	return $.jqplot('chart_' + chartNumber, [[null]], function() { });
}

function getLineChartOptions() {
	var options = {
		title:$("#title-project").text(),
		axes: {
			xaxis:{
                tickRenderer: $.jqplot.CanvasAxisTickRenderer ,
				renderer: $.jqplot.DateAxisRenderer,
				tickOptions:{
                    angle: -30,
                    fontSize: '7pt',
					formatString:'%d %b %Y %R',
					labelPosition: 'middle'
				}
			}
		},
		highlighter: {
			show: true,
			sizeAdjust: 7.5
		},
		seriesDefaults: {
			rendererOptions: {
				smooth: true,
				animation: {
					show: true
				}
			}
		},
		legend: {
			renderer: $.jqplot.EnhancedLegendRenderer,
			show:true
		},
		cursor: {
			show: true,
			zoom: true,
			tooltipLocation:'sw'
		}
	};
	
	return options
}

function getBarChartOptions() {
	var options = {
        title:$("#title-project").text(),
	    seriesDefaults:{
	        renderer:$.jqplot.BarRenderer,
	        pointLabels: { show: true },
	        rendererOptions: {
			barWidth: 10,
                animation: {
				show: true
                }
	        }
	    },
	    axes: {
	        xaxis: {
	            renderer: $.jqplot.DateAxisRenderer,
	            tickOptions:{
                    angle: -30,
                    fontSize: '7pt',
					formatString:'%d %b %Y %R',
					labelPosition: 'middle'
				}
	        }
	    },
	    legend: {
			renderer: $.jqplot.EnhancedLegendRenderer,
			show:true
		},
		cursor: {
			show: true,
			zoom: true,
			tooltipLocation:'sw'
		},
		highlighter: {
			show: true
		}
    };
	
	return options;
}

function getScatterChartOptions() {
	var options = {
		title:$("#title-project").text(),
		axes: {
			xaxis:{
				renderer: $.jqplot.DateAxisRenderer,
				tickOptions:{
                    angle: -30,
                    fontSize: '7pt',
					formatString:'%d %b %Y %R',
					labelPosition: 'middle'
				}
			}
		},
		highlighter: {
			show: true,
			sizeAdjust: 7.5
		},
		seriesDefaults: {
			rendererOptions: {
				smooth: true,
				animation: {
					show: true
				}
			},
			showLine:false
		},
		legend: {
			renderer: $.jqplot.EnhancedLegendRenderer,
			show:true
		},
		cursor: {
			show: true,
			zoom: true,
			tooltipLocation:'sw'
		}
	};
	
	return options;
}

function getPieChartOptions() {	
	var options = {
        title:$("#title-project").text(),
		grid: {
	        drawBorder: false,
	        drawGridlines: false,
	        background: '#ffffff',
	        shadow:false
	    },
	    axesDefaults: {
	         
	    },
	    seriesDefaults:{
	        renderer:$.jqplot.PieRenderer,
	        rendererOptions: {
	            showDataLabels: true
	        },
	        trendline:{ 
	        	show: true
        	}
	    },
	    legend: {
	        show: true,
	        rendererOptions: {
	            numberRows: 3
	        },
	        location: 's'
	    }
    };
}

function getCurrentChartTypeOptions(chartNumber) {
	switch ($('#chartType_' + chartNumber + ' input:radio:checked').val()) 
	{
		case "histo":
			return getBarChartOptions();
		case "courbe":
			return getLineChartOptions();
		case "nuage":
			return getScatterChartOptions();
		case "pie":
			return getPieChartOptions();
	}
}
